package com.example.demo.service.impl;

import com.example.demo.service.IGroupWorkFlowService;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class GroupWorkFlowService implements IGroupWorkFlowService {
    @Autowired
    private TaskService taskService;

    @Override
    public void claim(String taskId, String userId) {
        //分配的个人任务（即可是组任务中的成员，也可以是非组任务中的成员）
        taskService.claim(taskId, userId);
    }

    @Override
    public void setAssigee(String taskId) {
        taskService.setAssignee(taskId, null);
    }

    @Override
    public void addGroupUser(String taskId, String userId) {
        taskService.addCandidateUser(taskId, userId);
    }

    @Override
    public void deleteGroupUser(String taskId, String userId) {
        taskService.deleteCandidateUser(taskId, userId);
    }
}
